package net.hn.hnms.biz.cockpit.controller;


import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.hn.hnms.biz.cockpit.domain.vo.OptionVo;
import net.hn.hnms.biz.cockpit.domain.vo.SensorAlarmVo;
import net.hn.hnms.biz.cockpit.service.IProductCockpitService;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.satoken.config.AutoSetMineCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "生产驾驶舱", tags = {"生产驾驶舱"})
@RestController
@RequestMapping("/cockpit/product")
@RequiredArgsConstructor
public class ProductCockpitController {

    private final IProductCockpitService productCockpitService;

    @ApiOperation("人员分析")
    @GetMapping("/staff")
    @AutoSetMineCode
    public R<JSONObject> getStaffTrend(String mineCode) {
        return R.ok(productCockpitService.getStaffTrend(mineCode));
    }

    @ApiOperation("重点场所")
    @GetMapping("/majorPlace")
    @AutoSetMineCode
    public R<List<OptionVo>> getMajorPlace(String mineCode) {
        return R.ok(productCockpitService.getMajorPlace(mineCode));
    }

    @ApiOperation("重点场所人员趋势")
    @GetMapping("/majorPlaceStaff")
    @AutoSetMineCode
    public R<JSONObject> getMajorPlaceStaffTrend(String mineCode, @RequestParam("majorPlace")String majorPlace) {
        return R.ok(productCockpitService.getMajorPlaceStaffTrend(mineCode,majorPlace));
    }

    @ApiOperation("主要传感器告警")
    @GetMapping("/sensorAlarm")
    @AutoSetMineCode
    public R<List<SensorAlarmVo>> getSensorAlarm(String mineCode) {
        return R.ok(productCockpitService.getSensorAlarm(mineCode));
    }

    @ApiOperation("涌水量监测测点")
    @GetMapping("/overflowPoint")
    @AutoSetMineCode
    public R<List<OptionVo>> getOverflowPoint(String mineCode) {
        return R.ok(productCockpitService.getOverflowPoint(mineCode));
    }

    @ApiOperation("涌水量监测测点历史趋势")
    @GetMapping("/overflowPointTrend")
    @AutoSetMineCode
    public R<JSONObject> getOverflowPointTrend(String mineCode, @RequestParam("overflowPoint")String overflowPoint) {
        return R.ok(productCockpitService.getOverflowPointTrend(mineCode,overflowPoint));
    }

}
